package valeria.services;

import valeria.interfaces.SungJuk2IService;
import valeria.model.SungJuk2VO;

public class SungJuk2Service implements SungJuk2IService {

	@Override
	public void getTotal(SungJuk2VO sj) {
		int tot= sj.getKor()+sj.getEng()+sj.getMat();
		sj.setTot(tot);
		}

	@Override
	public void getAverage(SungJuk2VO sj) {
		double avg=(double)sj.getTot()/3;
		sj.setAvg(avg);
	}

	@Override
	public void getGrade(SungJuk2VO sj) {
		char grd;
		
		switch((int)sj.getAvg()/10){
		case 10:
		case 9:grd=SU;break;
		case 8:grd=WU;break;
		case 7:grd=MI;break;
		case 6:grd=YA;break;
		default : grd = GA;
		}
		sj.setGrd(grd);
	}

}
